package com.ruoyi.system.outto.goods.impl;

import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.GlobalException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.V2.gameAttr.mapper.GameAttributeMapper;
import com.ruoyi.system.V2.goodInfo.mapper.GoodsInfoImgMapper;
import com.ruoyi.system.V2.inter.mapper.ArtRecMapper;
import com.ruoyi.system.V2.inter.mapper.SalePartnerMapper;
import com.ruoyi.system.V2.inter.mapper.SelectPushMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.model.domain.*;
import com.ruoyi.system.model.dto.GoodsInfoAndAttrValueDto;
import com.ruoyi.system.outto.core.LCConstant;
import com.ruoyi.system.outto.game.CommonApi;
import com.ruoyi.system.outto.goods.NEWIPANZHI2API;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

/**
 * @Author sdq
 * @Date 2022/7/5 10:27
 */
@Slf4j
@Service
public class NEWPANZHI2Impl implements NEWIPANZHI2API {

    @Resource
    private CommonApi commonApi;

    @Resource
    private ArtRecMapper artRecMapper;

    @Resource
    private SelectPushMapper selectPushMapper;


    @Resource
    private GameAttributeMapper gameAttributeMapper;

    @Resource
    private GoodsInfoImgMapper goodsInfoImgMapper;

    //枪战王者 原神 英雄联盟 非合作游戏未测试
    private Map<String, Object> params(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner sa) {
        if(sa.getName().equals("盼之天空-英雄联盟(官方)")){
            goodsInfoAndAttrValueDto.setAccountNumber(goodsInfoAndAttrValueDto.getAccountNumber().substring(0,goodsInfoAndAttrValueDto.getAccountNumber().length()-1));
        }
        Map<String, Object> params = new TreeMap<>();
        Map<String, Object> action = new TreeMap<>();
        List<String> list = new ArrayList<>();
        params.put("accountSource","ORIGINAL_USER");
        params.put("bargain",true);
        params.put("buyConfidenceBuy",false);
        params.put("compensation",true);
        params.put("description","pzds upload img");
        params.put("title","pzds upload img");
        params.put("detailsCheckbox1",new ArrayList<>());
//        BigDecimal setScaleResult = goodsInfoAndAttrValueDto.getPrice().setScale(0, RoundingMode.DOWN);
        params.put("price",goodsInfoAndAttrValueDto.getPrice().toPlainString());
        params.put("basePrice",goodsInfoAndAttrValueDto.getPrice());
        params.put("detailsSection1",String.valueOf(Math.floor(goodsInfoAndAttrValueDto.getPrice().doubleValue())));
//        params.put("edit",false);
        params.put("gameAccount",goodsInfoAndAttrValueDto.getAccountNumber());
//        params.put("gameAccount",new Date().getTime());
        params.put("gameSecret",goodsInfoAndAttrValueDto.getAccountPassword());
        params.put("gameSecretRes",goodsInfoAndAttrValueDto.getAccountPassword());
        params.put("gameCatalogueId",null);
        params.put("goodsCatalogueId",6);
        params.put("goodsNo",null);
        params.put("isXiaomiTransfer",false);
        params.put("linkPhone", StringUtils.isNotEmpty(sa.getThreeOther())?sa.getThreeOther():sa.getSaleKey());
        params.put("linkQq", StringUtils.isNotEmpty(sa.getThreeOther())?sa.getThreeOther():sa.getSaleKey());
        params.put("linkWx", StringUtils.isNotEmpty(sa.getThreeOther())?sa.getThreeOther():sa.getSaleKey());
        params.put("sellMethod","ONLY_SELL");
        params.put("shotRemark",goodsInfoAndAttrValueDto.getDes().length()>149?goodsInfoAndAttrValueDto.getDes().substring(0,149):goodsInfoAndAttrValueDto.getDes());
        params.put("shotType","THIRD_SHOT");
        if(goodsInfoAndAttrValueDto.getGameName().equals("原神")) {
            params.put("gameId", 12);
            params.put("detailsSingle1", 1339);
            if(goodsInfoAndAttrValueDto.getCarrierName().equals("游戏官方")){
                params.put("single1", 534);
                params.put("single2", 536);
            }else {
                params.put("single1", 535);
                params.put("single2", 537);
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
                if(gameAttribute1.getFieldName().equals("男主")){
                    params.put("single5", 1284);
                }else {
                    params.put("single5", 1285);
                }
            }else{
                params.put("single5", 1284);
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF2()));
                if(gameAttribute1.getFieldName().equals("未绑定邮箱")){
                    params.put("single6", 1288);
                }else if(gameAttribute1.getFieldName().contains("已实名")){
                    params.put("single6", 1286);
                }else if(gameAttribute1.getFieldName().contains("未实名")||gameAttribute1.getFieldName().equals("邮箱已注销")){
                    params.put("single6", 1287);
                }else if(gameAttribute1.getFieldName().contains("不送邮箱/死邮")){
                    params.put("single6", 1289);
                }else if(gameAttribute1.getFieldName().contains("普通Q邮(随游戏出售)")){
                    params.put("single6", 2458);
                }else if(gameAttribute1.getFieldName().contains("字母Q邮")){
                    params.put("single6", 1447);
                }else {
                    params.put("single6", 1290);
                }
            }else{
                params.put("single6", 1288);
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF5())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF5()));
                if(gameAttribute1.getFieldName().equals("是")) {
                    params.put("single7", 2532);
                }else {
                    params.put("single7", 2533);
                }
            }else {
                params.put("single7", 2533);
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF20())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF20()));
                if(gameAttribute1.getFieldName().equals("有修改人脸机会/实名是本人")) {
                    params.put("single8", 3512);
                }else {
                    params.put("single8", 3513);
                }
            }else {
                params.put("single8", 3513);
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF4())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF4()));
                if(gameAttribute1.getFieldName().equals("是")) {
                    params.put("single9", 6987);
                }else {
                    params.put("single9", 6988);
                }
            }else {
                params.put("single9", 6988);
            }
            params.put("detailsSingle2", 9311);
            params.put("detailsSingle3", 13935);
        }
        if(goodsInfoAndAttrValueDto.getGameName().contains("崩坏")){
            params.put("gameId", 213);
            if(goodsInfoAndAttrValueDto.getCarrierName().equals("哔哩哔哩")) {
                params.put("single1", 6255);
            }else {
                params.put("single1", 6250);
            }
            params.put("single4", 7249);
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())){
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF2()));
                if(gameAttribute1.getFieldName().contains("未实名")){
                    params.put("single5", 7252);
                }else if(gameAttribute1.getFieldName().contains("已实名")){
                    params.put("single5", 7251);
                }else if(gameAttribute1.getFieldName().contains("未绑定邮箱")){
                    params.put("single5", 7253);
                }else if(gameAttribute1.getFieldName().contains("不送邮箱/死邮")){
                    params.put("single5", 7254);
                }else if(gameAttribute1.getFieldName().contains("普通Q邮箱（随游戏赠送）")){
                    params.put("single5", 7256);
                }else {
                    params.put("single5", 7254);//不送邮箱
                }
            }else {
                params.put("single5", 7254);
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF1())){
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF1()));
                if(gameAttribute1.getFieldName().equals("是")){
                    params.put("single6", 7258);
                }else {
                    params.put("single6", 7259);
                }
            }else {
                params.put("single6", 7259);
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF4())){
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF4()));
                if(gameAttribute1.getFieldName().equals("是")){
                    params.put("single7", 7260);
                }else {
                    params.put("single7", 7261);
                }
            }else {
                params.put("single7", 7261);
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())){
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
                if(gameAttribute1.getFieldName().equals("是")){
                    params.put("single8", 7262);
                }else {
                    params.put("single8", 7263);
                }
            }else {
                params.put("single8", 7263);
            }
        }
        if(goodsInfoAndAttrValueDto.getGameName().contains("王者荣耀")){
            params.put("shotType", "PZDS_OFFICIAL");
            params.put("gameId", 7);
            String regional = goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName();
            if(regional.equals("安卓QQ")){
                params.put("single1", 246);
            }else if(regional.equals("安卓微信")){
                params.put("single1", 248);
            }else if(regional.equals("苹果QQ")){
                params.put("single1", 247);
            }else {
                params.put("single1", 249);
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())){
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF2()));
                String string = "[{\"value\":\"10\",\"key\":12051},{\"value\":\"9\",\"key\":12052},{\"value\":\"8\",\"key\":12053},{\"value\":\"7\",\"key\":12054},{\"value\":\"6\",\"key\":12055},{\"value\":\"5\",\"key\":12056},{\"value\":\"4\",\"key\":12057},{\"value\":\"3\",\"key\":12058},{\"value\":\"2\",\"key\":12059},{\"value\":\"1\",\"key\":12060},{\"value\":\"0\",\"key\":12061}]\n";
                JSONArray jsonArray = JSONArray.parseArray(string);
                for(Object o : jsonArray){
                    if(gameAttribute1.getFieldName().replace("V","").equals(JSONObject.parseObject(o.toString()).getString("value"))){
                        params.put("detailsSingle2", JSONObject.parseObject(o.toString()).getInteger("key"));
                        break;
                    }
                }
            }else {
                params.put("detailsSingle2",12061);
            }
            params.put("detailsSingle3", 13944);
            list = new ArrayList<>();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF10())){
                List<GameAttribute> gameAttributs = getGameAttributs(goodsInfoAndAttrValueDto.getF10());
                String string = "[{\"value\":\"金色仲夏夜\",\"key\":1466},{\"value\":\"幽冥之眼\",\"key\":1467},{\"value\":\"幽冥火\",\"key\":1468},{\"value\":\"幻海之心\",\"key\":1469},{\"value\":\"未来机甲\",\"key\":1470},{\"value\":\"零号雷霆\",\"key\":1471},{\"value\":\"时之愿境\",\"key\":1475},{\"value\":\"时之思念\",\"key\":2560},{\"value\":\"时之羁绊\",\"key\":3519},{\"value\":\"黛羽霜翎\",\"key\":6176},{\"value\":\"无限倾心\",\"key\":6999},{\"value\":\"星际治安官\",\"key\":3527},{\"value\":\"玉鸾吟\",\"key\":7371},{\"value\":\"乞巧织春\",\"key\":7372},{\"value\":\"青鸾有意\",\"key\":7425},{\"value\":\"云鹰彻晓\",\"key\":11159},{\"value\":\"无\",\"key\":3520}]\n";
                JSONArray jsonArray = JSONArray.parseArray(string);
                for(GameAttribute gameAttribute1 : gameAttributs){
                    for(Object o :  jsonArray){
                        if(gameAttribute1.getFieldName().contains(JSONObject.parseObject(o.toString()).getString("value"))){
                            list.add(JSONObject.parseObject(o.toString()).getString("value"));
                        }
                    }
                }
            }
            if(CollectionUtils.isEmpty(list)){
                list.add("无");
            }
            params.put("detailsCheckbox2",list);
            params.put("detailsSingle1",13209);
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF16())){
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF16()));
                if(gameAttribute1.getFieldName().equals("可二次实名")){
                    params.put("single4",2164);
                }else if(gameAttribute1.getFieldName().equals("不可二次实名")){
                    params.put("single4",2165);
                }else {
                    params.put("single4",7610);
                }
            }else {
                params.put("single4",2165);
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF18())){
                list = new ArrayList<>();
                String string = "[{\"value\":\"大国标敖隐\",\"key\":12036},{\"value\":\"大国标裴擒虎\",\"key\":11264},{\"value\":\"大国标杨玉环\",\"key\":11265},{\"value\":\"大国标公孙离\",\"key\":11266},{\"value\":\"大国标明世隐\",\"key\":11267},{\"value\":\"大国标女娲\",\"key\":11268},{\"value\":\"大国标梦奇\",\"key\":11269},{\"value\":\"大国标苏烈\",\"key\":11270},{\"value\":\"大国标百里玄策\",\"key\":11271},{\"value\":\"大国标百里守约\",\"key\":11272},{\"value\":\"大国标铠\",\"key\":11273},{\"value\":\"大国标鬼谷子\",\"key\":11274},{\"value\":\"大国标干将莫邪\",\"key\":11275},{\"value\":\"大国标东皇太一\",\"key\":11276},{\"value\":\"大国标大乔\",\"key\":11277},{\"value\":\"大国标黄忠\",\"key\":11278},{\"value\":\"大国标诸葛亮\",\"key\":11279},{\"value\":\"大国标哪吒\",\"key\":11280},{\"value\":\"大国标太乙真人\",\"key\":11281},{\"value\":\"大国标蔡文姬\",\"key\":11282},{\"value\":\"大国标雅典娜\",\"key\":11283},{\"value\":\"大国标杨戬\",\"key\":11284},{\"value\":\"大国标成吉思汗\",\"key\":11285},{\"value\":\"大国标钟馗\",\"key\":11286},{\"value\":\"大国标虞姬\",\"key\":11287},{\"value\":\"大国标李元芳\",\"key\":11288},{\"value\":\"大国标张飞\",\"key\":11289},{\"value\":\"大国标刘备\",\"key\":11290},{\"value\":\"大国标后羿\",\"key\":11291},{\"value\":\"大国标牛魔\",\"key\":11292},{\"value\":\"大国标孙悟空\",\"key\":11293},{\"value\":\"大国标亚瑟\",\"key\":11294},{\"value\":\"大国标橘右京\",\"key\":11295},{\"value\":\"大国标娜可露露\",\"key\":11296},{\"value\":\"大国标不知火舞\",\"key\":11297},{\"value\":\"大国标张良\",\"key\":11298},{\"value\":\"大国标花木兰\",\"key\":11299},{\"value\":\"大国标兰陵王\",\"key\":11300},{\"value\":\"大国标王昭君\",\"key\":11301},{\"value\":\"大国标韩信\",\"key\":11302},{\"value\":\"大国标刘邦\",\"key\":11303},{\"value\":\"大国标姜子牙\",\"key\":11304},{\"value\":\"大国标露娜\",\"key\":11305},{\"value\":\"大国标程咬金\",\"key\":11306},{\"value\":\"大国标安琪拉\",\"key\":11307},{\"value\":\"大国标貂蝉\",\"key\":11308},{\"value\":\"大国标关羽\",\"key\":11309},{\"value\":\"大国标老夫子\",\"key\":11310},{\"value\":\"大国标武则天\",\"key\":11311},{\"value\":\"大国标项羽\",\"key\":11312},{\"value\":\"大国标达摩\",\"key\":11313},{\"value\":\"大国标狄仁杰\",\"key\":11314},{\"value\":\"大国标马可波罗\",\"key\":11315},{\"value\":\"大国标李白\",\"key\":11316},{\"value\":\"大国标宫本武藏\",\"key\":11317},{\"value\":\"大国标典韦\",\"key\":11318},{\"value\":\"大国标曹操\",\"key\":11319},{\"value\":\"大国标甄姬\",\"key\":11320},{\"value\":\"大国标夏侯淳\",\"key\":11321},{\"value\":\"大国标周瑜\",\"key\":11322},{\"value\":\"大国标吕布\",\"key\":11323},{\"value\":\"大国标芈月\",\"key\":11324},{\"value\":\"大国标白起\",\"key\":11325},{\"value\":\"大国标扁鹊\",\"key\":11326},{\"value\":\"大国标孙膑\",\"key\":11327},{\"value\":\"大国标钟无艳\",\"key\":11328},{\"value\":\"大国标阿轲\",\"key\":11329},{\"value\":\"大国标高渐离\",\"key\":11330},{\"value\":\"大国标刘禅\",\"key\":11331},{\"value\":\"大国标庄周\",\"key\":11332},{\"value\":\"大国标鲁班七号\",\"key\":11333},{\"value\":\"大国标孙尚香\",\"key\":11334},{\"value\":\"大国标嬴政\",\"key\":11335},{\"value\":\"大国标妲己\",\"key\":11336},{\"value\":\"大国标墨子\",\"key\":11337},{\"value\":\"大国标赵云\",\"key\":11338},{\"value\":\"大国标小乔\",\"key\":11339},{\"value\":\"大国标廉颇\",\"key\":11340},{\"value\":\"大国标海诺\",\"key\":11222},{\"value\":\"大国标朵莉亚\",\"key\":11225},{\"value\":\"大国标亚连\",\"key\":11226},{\"value\":\"大国标姬小满\",\"key\":11227},{\"value\":\"大国标莱西奥\",\"key\":11228},{\"value\":\"大国标赵怀真\",\"key\":11229},{\"value\":\"大国标海月\",\"key\":11230},{\"value\":\"大国标戈娅\",\"key\":11231},{\"value\":\"大国标桑启\",\"key\":11232},{\"value\":\"大国标暃\",\"key\":11233},{\"value\":\"大国标金蝉\",\"key\":11234},{\"value\":\"大国标云缨\",\"key\":11235},{\"value\":\"大国标艾琳\",\"key\":11236},{\"value\":\"大国标司空震\",\"key\":11237},{\"value\":\"大国标澜\",\"key\":11238},{\"value\":\"大国标夏洛特\",\"key\":11239},{\"value\":\"大国标阿古朵\",\"key\":11240},{\"value\":\"大国标蒙恬\",\"key\":11241},{\"value\":\"大国标镜\",\"key\":11242},{\"value\":\"大国标蒙犽\",\"key\":11243},{\"value\":\"大国标鲁班大师\",\"key\":11244},{\"value\":\"大国标西施\",\"key\":11245},{\"value\":\"大国标马超\",\"key\":11246},{\"value\":\"大国标曜\",\"key\":11247},{\"value\":\"大国标云中君\",\"key\":11248},{\"value\":\"大国标瑶\",\"key\":11249},{\"value\":\"大国标盘古\",\"key\":11250},{\"value\":\"大国标猪八戒\",\"key\":11251},{\"value\":\"大国标嫦娥\",\"key\":11252},{\"value\":\"大国标上官婉儿\",\"key\":11253},{\"value\":\"大国标李信\",\"key\":11254},{\"value\":\"大国标沈梦溪\",\"key\":11255},{\"value\":\"大国标伽罗\",\"key\":11256},{\"value\":\"大国标盾山\",\"key\":11257},{\"value\":\"大国标司马懿\",\"key\":11258},{\"value\":\"大国标孙策\",\"key\":11259},{\"value\":\"大国标元歌\",\"key\":11260},{\"value\":\"大国标米莱狄\",\"key\":11261},{\"value\":\"大国标狂铁\",\"key\":11262},{\"value\":\"大国标弈星\",\"key\":11263}]\n";
                JSONArray jsonArray = JSONArray.parseArray(string);
                for(Object o : jsonArray){
                    if(goodsInfoAndAttrValueDto.getF18().contains(JSONObject.parseObject(o.toString()).getString("value").replace("大国标",""))){
                        list.add(JSONObject.parseObject(o.toString()).getString("key"));
                    }
                }
                if(!CollectionUtils.isEmpty(list)){
                    params.put("checkbox1",list);
                }
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF18())){
                list = new ArrayList<>();
                String string = "[{\"value\":\"小国标敖隐\",\"key\":12037},{\"value\":\"小国标朵莉亚\",\"key\":11341},{\"value\":\"小国标亚连\",\"key\":11342},{\"value\":\"小国标姬小满\",\"key\":11343},{\"value\":\"小国标莱西奥\",\"key\":11344},{\"value\":\"小国标赵怀真\",\"key\":11345},{\"value\":\"小国标海月\",\"key\":11346},{\"value\":\"小国标戈娅\",\"key\":11347},{\"value\":\"小国标桑启\",\"key\":11348},{\"value\":\"小国标暃\",\"key\":11349},{\"value\":\"小国标金蝉\",\"key\":11350},{\"value\":\"小国标云缨\",\"key\":11351},{\"value\":\"小国标艾琳\",\"key\":11352},{\"value\":\"小国标司空震\",\"key\":11353},{\"value\":\"小国标标澜\",\"key\":11354},{\"value\":\"小国标夏洛特\",\"key\":11355},{\"value\":\"小国标阿古朵\",\"key\":11356},{\"value\":\"小国标蒙恬\",\"key\":11357},{\"value\":\"小国标镜\",\"key\":11358},{\"value\":\"小国标蒙犽\",\"key\":11359},{\"value\":\"小国标鲁班大师\",\"key\":11360},{\"value\":\"小国标西施\",\"key\":11361},{\"value\":\"小国标马超\",\"key\":11362},{\"value\":\"小国标曜\",\"key\":11363},{\"value\":\"小国标云中君\",\"key\":11364},{\"value\":\"小国标瑶\",\"key\":11365},{\"value\":\"小国标盘古\",\"key\":11366},{\"value\":\"小国标猪八戒\",\"key\":11367},{\"value\":\"小国标嫦娥\",\"key\":11368},{\"value\":\"小国标上官婉儿\",\"key\":11369},{\"value\":\"小国标李信\",\"key\":11370},{\"value\":\"小国标沈梦溪\",\"key\":11371},{\"value\":\"小国标伽罗\",\"key\":11372},{\"value\":\"小国标盾山\",\"key\":11373},{\"value\":\"小国标司马懿\",\"key\":11374},{\"value\":\"小国标孙策\",\"key\":11375},{\"value\":\"小国标元歌\",\"key\":11376},{\"value\":\"小国标米莱狄\",\"key\":11377},{\"value\":\"小国标狂铁\",\"key\":11378},{\"value\":\"小国标弈星\",\"key\":11379},{\"value\":\"小国标裴擒虎\",\"key\":11380},{\"value\":\"小国标杨玉环\",\"key\":11381},{\"value\":\"小国标公孙离\",\"key\":11382},{\"value\":\"小国标明世隐\",\"key\":11383},{\"value\":\"小国标女娲\",\"key\":11384},{\"value\":\"小国标梦奇\",\"key\":11385},{\"value\":\"小国标苏烈\",\"key\":11386},{\"value\":\"小国标百里玄策\",\"key\":11387},{\"value\":\"小国标百里守约\",\"key\":11388},{\"value\":\"小国标铠\",\"key\":11389},{\"value\":\"小国标鬼谷子\",\"key\":11390},{\"value\":\"小国标干将莫邪\",\"key\":11391},{\"value\":\"小国标东皇太一\",\"key\":11392},{\"value\":\"小国标大乔\",\"key\":11393},{\"value\":\"小国标黄忠\",\"key\":11394},{\"value\":\"小国标诸葛亮\",\"key\":11395},{\"value\":\"小国标哪吒\",\"key\":11396},{\"value\":\"小国标太乙真人\",\"key\":11397},{\"value\":\"小国标蔡文姬\",\"key\":11398},{\"value\":\"小国标雅典娜\",\"key\":11399},{\"value\":\"小国标杨戬\",\"key\":11400},{\"value\":\"小国标成吉思汗\",\"key\":11401},{\"value\":\"小国标钟馗\",\"key\":11402},{\"value\":\"小国标虞姬\",\"key\":11403},{\"value\":\"小国标李元芳\",\"key\":11404},{\"value\":\"小国标张飞\",\"key\":11405},{\"value\":\"小国标刘备\",\"key\":11406},{\"value\":\"小国标后羿\",\"key\":11407},{\"value\":\"小国标牛魔\",\"key\":11408},{\"value\":\"小国标孙悟空\",\"key\":11409},{\"value\":\"小国标亚瑟\",\"key\":11410},{\"value\":\"小国标橘右京\",\"key\":11411},{\"value\":\"小国标娜可露露\",\"key\":11412},{\"value\":\"小国标不知火舞\",\"key\":11413},{\"value\":\"小国标张良\",\"key\":11414},{\"value\":\"小国标花木兰\",\"key\":11415},{\"value\":\"小国标兰陵王\",\"key\":11416},{\"value\":\"小国标王昭君\",\"key\":11417},{\"value\":\"小国标韩信\",\"key\":11418},{\"value\":\"小国标刘邦\",\"key\":11419},{\"value\":\"小国标姜子牙\",\"key\":11420},{\"value\":\"小国标露娜\",\"key\":11421},{\"value\":\"小国标程咬金\",\"key\":11422},{\"value\":\"小国标安琪拉\",\"key\":11423},{\"value\":\"小国标貂蝉\",\"key\":11424},{\"value\":\"小国标关羽\",\"key\":11425},{\"value\":\"小国标老夫子\",\"key\":11426},{\"value\":\"小国标武则天\",\"key\":11427},{\"value\":\"小国标项羽\",\"key\":11428},{\"value\":\"小国标达摩\",\"key\":11429},{\"value\":\"小国标狄仁杰\",\"key\":11430},{\"value\":\"小国标马可波罗\",\"key\":11431},{\"value\":\"小国标李白\",\"key\":11432},{\"value\":\"小国标宫本武藏\",\"key\":11433},{\"value\":\"小国标典韦\",\"key\":11434},{\"value\":\"小国标曹操\",\"key\":11435},{\"value\":\"小国标甄姬\",\"key\":11436},{\"value\":\"小国标夏侯淳\",\"key\":11437},{\"value\":\"小国标周瑜\",\"key\":11438},{\"value\":\"小国标吕布\",\"key\":11439},{\"value\":\"小国标芈月\",\"key\":11440},{\"value\":\"小国标白起\",\"key\":11441},{\"value\":\"小国标扁鹊\",\"key\":11442},{\"value\":\"小国标孙膑\",\"key\":11443},{\"value\":\"小国标钟无艳\",\"key\":11444},{\"value\":\"小国标阿轲\",\"key\":11445},{\"value\":\"小国标高渐离\",\"key\":11446},{\"value\":\"小国标刘禅\",\"key\":11447},{\"value\":\"小国标庄周\",\"key\":11448},{\"value\":\"小国标鲁班七号\",\"key\":11449},{\"value\":\"小国标孙尚香\",\"key\":11450},{\"value\":\"小国标嬴政\",\"key\":11451},{\"value\":\"小国标妲己\",\"key\":11452},{\"value\":\"小国标墨子\",\"key\":11453},{\"value\":\"小国标赵云\",\"key\":11454},{\"value\":\"小国标小乔\",\"key\":11455},{\"value\":\"小国标廉颇\",\"key\":11456},{\"value\":\"小国标海诺\",\"key\":11223}]\n";
                JSONArray jsonArray = JSONArray.parseArray(string);
                for(Object o : jsonArray){
                    if(goodsInfoAndAttrValueDto.getF18().contains(JSONObject.parseObject(o.toString()).getString("value").replace("小国标",""))){
                        list.add(JSONObject.parseObject(o.toString()).getString("key"));
                    }
                }
                if(!CollectionUtils.isEmpty(list)){
                    params.put("checkbox2",list);
                }
            }
            params.put("single5",11468);
            params.put("single6",12067);
            params.put("detailsText1", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF17())?goodsInfoAndAttrValueDto.getF17():"123456");
        }
        if(goodsInfoAndAttrValueDto.getGameName().equals("英雄联盟")){
            params.put("gameId",6);
            params.put("gameName","英雄联盟(LOL)");
            params.put("single3",null);

            String string = "[{\"gameId\":6,\"createTime\":\"2021-10-28 14:19:50\",\"children\":[{\"gameId\":6,\"createTime\":\"2021-10-28 14:20:29\",\"children\":[],\"name\":\"艾欧尼亚\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":215,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:20:36\",\"children\":[],\"name\":\"祖安\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":216,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:20:43\",\"children\":[],\"name\":\"诺克萨斯\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":217,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:20:47\",\"children\":[],\"name\":\"班德尔城\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":218,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:20:52\",\"children\":[],\"name\":\"皮尔特沃夫\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":219,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:20:56\",\"children\":[],\"name\":\"战争学院\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":220,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:21:00\",\"children\":[],\"name\":\"雷瑟守备\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":221,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:21:05\",\"children\":[],\"name\":\"巨神峰\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":222,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:21:09\",\"children\":[],\"name\":\"裁决之地\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":223,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:21:13\",\"children\":[],\"name\":\"黑色玫瑰\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":224,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:21:19\",\"children\":[],\"name\":\"暗影岛\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":225,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:21:23\",\"children\":[],\"name\":\"钢铁烈阳\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":226,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:21:28\",\"children\":[],\"name\":\"水晶之痕\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":227,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:21:35\",\"children\":[],\"name\":\"均衡教派\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":228,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:21:38\",\"children\":[],\"name\":\"影流\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":229,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:22:08\",\"children\":[],\"name\":\"守望之海\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":230,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:22:16\",\"children\":[],\"name\":\"征服之海\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":231,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:22:21\",\"children\":[],\"name\":\"卡拉曼达\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":232,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:22:29\",\"children\":[],\"name\":\"皮城警备\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":233,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:22:34\",\"children\":[],\"name\":\"云顶之巅\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":209,\"id\":234,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004}],\"name\":\"电信\",\"gamePropertyConfigName\":\"大区\",\"mappingField\":\"single1\",\"pid\":0,\"id\":209,\"sort\":0,\"floor\":1,\"gamePropertyConfigId\":1003},{\"gameId\":6,\"createTime\":\"2021-10-28 14:19:54\",\"children\":[{\"gameId\":6,\"createTime\":\"2021-10-28 14:22:55\",\"children\":[],\"name\":\"比尔吉沃特\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":210,\"id\":235,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:23:01\",\"children\":[],\"name\":\"德玛西亚\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":210,\"id\":236,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:23:07\",\"children\":[],\"name\":\"弗雷尔卓德\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":210,\"id\":237,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:23:12\",\"children\":[],\"name\":\"无畏先锋\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":210,\"id\":238,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:23:17\",\"children\":[],\"name\":\"恕瑞玛\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":210,\"id\":239,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:23:22\",\"children\":[],\"name\":\"扭曲丛林\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":210,\"id\":240,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004},{\"gameId\":6,\"createTime\":\"2021-10-28 14:23:26\",\"children\":[],\"name\":\"巨龙之巢\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":210,\"id\":241,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004}],\"name\":\"网通\",\"gamePropertyConfigName\":\"大区\",\"mappingField\":\"single1\",\"pid\":0,\"id\":210,\"sort\":0,\"floor\":1,\"gamePropertyConfigId\":1003},{\"gameId\":6,\"createTime\":\"2021-10-28 14:19:58\",\"children\":[{\"gameId\":6,\"createTime\":\"2021-10-28 14:23:44\",\"children\":[],\"name\":\"峡谷之巅\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":211,\"id\":242,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004}],\"name\":\"峡谷之巅\",\"gamePropertyConfigName\":\"大区\",\"mappingField\":\"single1\",\"pid\":0,\"id\":211,\"sort\":0,\"floor\":1,\"gamePropertyConfigId\":1003},{\"gameId\":6,\"createTime\":\"2021-10-28 14:20:05\",\"children\":[{\"gameId\":6,\"createTime\":\"2021-10-28 14:23:54\",\"children\":[],\"name\":\"男爵领域\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":212,\"id\":243,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004}],\"name\":\"男爵领域\",\"gamePropertyConfigName\":\"大区\",\"mappingField\":\"single1\",\"pid\":0,\"id\":212,\"sort\":0,\"floor\":1,\"gamePropertyConfigId\":1003},{\"gameId\":6,\"createTime\":\"2021-10-28 14:20:09\",\"children\":[{\"gameId\":6,\"createTime\":\"2021-10-28 14:24:00\",\"children\":[],\"name\":\"教育网专区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":213,\"id\":244,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1004}],\"name\":\"教育网专区\",\"gamePropertyConfigName\":\"大区\",\"mappingField\":\"single1\",\"pid\":0,\"id\":213,\"sort\":0,\"floor\":1,\"gamePropertyConfigId\":1003}]\n";
            JSONArray jsonArray = JSONArray.parseArray(string);
            for(Object o : jsonArray){
                String children = JSONObject.parseObject(o.toString()).getString("children");
                JSONArray jsonArray1 = JSONArray.parseArray(children);
                for(Object p : jsonArray1){
                    if(goodsInfoAndAttrValueDto.getServerName().contains(JSONObject.parseObject(p.toString()).getString("name"))){
                        params.put("single1", JSONObject.parseObject(o.toString()).getString("id"));
                        params.put("single2", JSONObject.parseObject(p.toString()).getString("id"));
                        break;
                    }
                }
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF1())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF1()));
                if(gameAttribute1.getFieldName().contains("有修改人脸机会")) {
                    params.put("single4", 12332);
                }else {
                    params.put("single4", 12333);
                }
            }else {
                params.put("single4", 12333);
            }
            params.put("detailsSingle1",1318);
            params.put("detailsSingle2", 4728);
            params.put("detailsSingle3", 13163);
            params.put("detailsSingle4", 2586);
//            params.put("detailsSingle5", 11200);
            params.put("detailsSingle6", 13945);
            params.put("pcIconUrl", "https://pzdsoss.pzds.com/game/20230109/Nbb2e3_1673235074962.png");
//            params.put("sellMethod", null);
//            params.put("shotRemark", null);
            params.put("shotType", "THIRD_SHOT");
            params.put("edit",false);
        }
        if(goodsInfoAndAttrValueDto.getGameName().contains("穿越火线")){
            params.put("gameId", 16);
            String string = "[{\"gameId\":16,\"createTime\":\"2021-10-28 18:28:16\",\"children\":[{\"gameId\":16,\"createTime\":\"2021-10-28 18:35:33\",\"children\":[],\"name\":\"福建一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":900,\"id\":904,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:35:44\",\"children\":[],\"name\":\"安徽一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":900,\"id\":905,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:35:49\",\"children\":[],\"name\":\"上海一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":900,\"id\":906,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:35:55\",\"children\":[],\"name\":\"上海二区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":900,\"id\":907,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:36:00\",\"children\":[],\"name\":\"浙江一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":900,\"id\":908,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:36:06\",\"children\":[],\"name\":\"浙江二区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":900,\"id\":909,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:36:32\",\"children\":[],\"name\":\"江苏一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":900,\"id\":910,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:36:38\",\"children\":[],\"name\":\"江苏二区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":900,\"id\":911,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:36:42\",\"children\":[],\"name\":\"教育\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":900,\"id\":912,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:36:46\",\"children\":[],\"name\":\"移动\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":900,\"id\":913,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090}],\"name\":\"东部战区\",\"gamePropertyConfigName\":\"战区\",\"mappingField\":\"single1\",\"pid\":0,\"id\":900,\"sort\":0,\"floor\":1,\"gamePropertyConfigId\":1089},{\"gameId\":16,\"createTime\":\"2021-10-28 18:28:21\",\"children\":[{\"gameId\":16,\"createTime\":\"2021-10-28 18:37:05\",\"children\":[],\"name\":\"江西一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":901,\"id\":914,\"sort\":1000,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:37:11\",\"children\":[],\"name\":\"南方大区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":901,\"id\":915,\"sort\":999,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:37:15\",\"children\":[],\"name\":\"湖南一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":901,\"id\":916,\"sort\":998,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:37:20\",\"children\":[],\"name\":\"湖南二区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":901,\"id\":917,\"sort\":997,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:37:25\",\"children\":[],\"name\":\"湖北一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":901,\"id\":918,\"sort\":996,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:37:29\",\"children\":[],\"name\":\"湖北二区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":901,\"id\":919,\"sort\":995,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:37:40\",\"children\":[],\"name\":\"广西一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":901,\"id\":921,\"sort\":994,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:37:35\",\"children\":[],\"name\":\"广东一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":901,\"id\":920,\"sort\":993,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:37:52\",\"children\":[],\"name\":\"广东二区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":901,\"id\":923,\"sort\":992,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:37:47\",\"children\":[],\"name\":\"广东三区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":901,\"id\":922,\"sort\":991,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-11-24 21:51:45\",\"children\":[],\"name\":\"广东四区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":901,\"id\":2144,\"sort\":990,\"floor\":2,\"gamePropertyConfigId\":1090}],\"name\":\"南部战区\",\"gamePropertyConfigName\":\"战区\",\"mappingField\":\"single1\",\"pid\":0,\"id\":901,\"sort\":0,\"floor\":1,\"gamePropertyConfigId\":1089},{\"gameId\":16,\"createTime\":\"2021-10-28 18:28:29\",\"children\":[{\"gameId\":16,\"createTime\":\"2021-10-28 18:38:08\",\"children\":[],\"name\":\"四川一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":902,\"id\":924,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:38:16\",\"children\":[],\"name\":\"四川二区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":902,\"id\":925,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:38:46\",\"children\":[],\"name\":\"重庆一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":902,\"id\":926,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:38:51\",\"children\":[],\"name\":\"云南一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":902,\"id\":927,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:38:57\",\"children\":[],\"name\":\"陕西一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":902,\"id\":928,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090}],\"name\":\"西部战区\",\"gamePropertyConfigName\":\"战区\",\"mappingField\":\"single1\",\"pid\":0,\"id\":902,\"sort\":0,\"floor\":1,\"gamePropertyConfigId\":1089},{\"gameId\":16,\"createTime\":\"2021-10-28 18:28:35\",\"children\":[{\"gameId\":16,\"createTime\":\"2021-10-28 18:39:16\",\"children\":[],\"name\":\"河北一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":903,\"id\":929,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:39:24\",\"children\":[],\"name\":\"山西一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":903,\"id\":930,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:39:29\",\"children\":[],\"name\":\"北京一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":903,\"id\":931,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:39:35\",\"children\":[],\"name\":\"北京二区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":903,\"id\":932,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:39:40\",\"children\":[],\"name\":\"北京三区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":903,\"id\":933,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:39:46\",\"children\":[],\"name\":\"北京四区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":903,\"id\":934,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:39:52\",\"children\":[],\"name\":\"山东一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":903,\"id\":935,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:39:57\",\"children\":[],\"name\":\"山东二区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":903,\"id\":936,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:40:02\",\"children\":[],\"name\":\"河南二区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":903,\"id\":937,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:40:08\",\"children\":[],\"name\":\"吉林一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":903,\"id\":938,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:40:14\",\"children\":[],\"name\":\"北方大区（网通）\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":903,\"id\":939,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:40:19\",\"children\":[],\"name\":\"黑龙江一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":903,\"id\":940,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:40:23\",\"children\":[],\"name\":\"辽宁一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":903,\"id\":941,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:40:30\",\"children\":[],\"name\":\"辽宁二区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":903,\"id\":942,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:40:35\",\"children\":[],\"name\":\"辽宁三区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":903,\"id\":943,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090},{\"gameId\":16,\"createTime\":\"2021-10-28 18:40:41\",\"children\":[],\"name\":\"河南一区\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":903,\"id\":944,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090}],\"name\":\"北部战区\",\"gamePropertyConfigName\":\"战区\",\"mappingField\":\"single1\",\"pid\":0,\"id\":903,\"sort\":0,\"floor\":1,\"gamePropertyConfigId\":1089},{\"gameId\":16,\"createTime\":\"2022-09-23 11:34:14\",\"children\":[{\"gameId\":16,\"createTime\":\"2022-09-23 11:34:23\",\"children\":[],\"name\":\"CFHD\",\"gamePropertyConfigName\":\"服务器\",\"mappingField\":\"single2\",\"pid\":4599,\"id\":4600,\"sort\":0,\"floor\":2,\"gamePropertyConfigId\":1090}],\"name\":\"CFHD大区\",\"gamePropertyConfigName\":\"战区\",\"mappingField\":\"single1\",\"pid\":0,\"id\":4599,\"sort\":0,\"floor\":1,\"gamePropertyConfigId\":1089}]\n";
            JSONArray jsonArray = JSONArray.parseArray(string);
            for(Object o : jsonArray){
                String children = JSONObject.parseObject(o.toString()).getString("children");
                JSONArray jsonArray1 = JSONArray.parseArray(children);
                for(Object p : jsonArray1){
                    if(goodsInfoAndAttrValueDto.getServerName().replace("黑龙江区","黑龙江一区").contains(JSONObject.parseObject(p.toString()).getString("name"))){
                        params.put("single1", JSONObject.parseObject(o.toString()).getString("id"));
                        params.put("single2", JSONObject.parseObject(p.toString()).getString("id"));
                        break;
                    }
                }
            }
            params.put("detailsSingle1", 1353);
            params.put("detailsSingle2", 13953);
//            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())){
//                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
//                if(gameAttribute1.getFieldName().contains("有修改机会且实名是本人")){
//                    params.put("detailsSingle2", 2551);
//                }else {
//                    params.put("detailsSingle2", 2552);
//                }
//            }else {
//                params.put("detailsSingle2", 2552);
//            }
            if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())) {
                GameAttribute gameAttribute1 =
                        gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
                if (gameAttribute1.getFieldName().contains("有修改机会且实名是本人")) {
//                    params.put("detailsSingle2", 2551);
                    params.put("single7", 12760);
                } else {
//                    params.put("detailsSingle2", 2552);
                    params.put("single7", 12761);
                }
            } else {
//                params.put("detailsSingle2", 2552);
                params.put("single7", 12761);
            }
            params.put("single4", 4834);
            params.put("single5", 5839);
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF20())) {
                list = new ArrayList<>();
                List<GameAttribute> gameAttributs = getGameAttributs(goodsInfoAndAttrValueDto.getF20());
                String string1 = "[{\"value\":\"火麒麟音效卡\",\"key\":7715},{\"value\":\"毁灭音效卡\",\"key\":7716},{\"value\":\"雷神音效卡\",\"key\":7717},{\"value\":\"无\",\"key\":7718}]\n";
                JSONArray jsonArray1 = JSONArray.parseArray(string1);
                for(GameAttribute gameAttribute1 : gameAttributs){
                    for(Object o : jsonArray1){
                        if(gameAttribute1.getFieldName().contains(JSONObject.parseObject(o.toString()).getString("value"))){
                            list.add(JSONObject.parseObject(o.toString()).getString("key"));
                        }
                    }
                }
            }else {
                list.add("7718");
            }
            if(CollectionUtils.isEmpty(list)) {
                list.add("7718");
            }
            params.put("detailsCheckbox1", list);
            params.put("detailsSingle3", 9608);
            params.put("single6", 11216);
            params.put("single7", 12760);
        }
        if(goodsInfoAndAttrValueDto.getGameName().equals("英雄联盟(手游)")){
            params.put("gameAccount",String.valueOf(System.currentTimeMillis()).substring(3));
            params.put("description",goodsInfoAndAttrValueDto.getDes());
            params.put("title",goodsInfoAndAttrValueDto.getTitle());
            params.put("gameName","英雄联盟手游");
            params.put("gameId", 17);
            String regional = goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName();
            if(regional.equals("安卓QQ")){
                params.put("single1", 945);
            }else if(regional.equals("安卓微信")){
                params.put("single1", 948);
            }else if(regional.equals("苹果QQ")){
                params.put("single1", 946);
            }else {
                params.put("single1", 949);
            }
            params.put("detailsSingle1", 1355);
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF4())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF4()));
                if(gameAttribute1.getFieldName().equals("可二次实名")) {
                    params.put("detailsSingle2", 7595);
                }else {
                    params.put("detailsSingle2", 7596);
                }
            }else {
                params.put("detailsSingle2", 7596);
            }
            params.put("detailsSingle3", 13956);
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())){
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
                String string = "[{\"value\":\"坚韧黑铁\",\"key\":10548},{\"value\":\"英勇黄铜\",\"key\":10549},{\"value\":\"不屈白银\",\"key\":10550},{\"value\":\"荣耀黄金\",\"key\":10551},{\"value\":\"华贵铂金\",\"key\":10552},{\"value\":\"流光翡翠\",\"key\":10553},{\"value\":\"璀璨钻石\",\"key\":10554},{\"value\":\"超凡大师\",\"key\":10555},{\"value\":\"傲世宗师\",\"key\":10556},{\"value\":\"最强王者\",\"key\":10557},{\"value\":\"至尊王者\",\"key\":10558}]\n";
                JSONArray jsonArray = JSONArray.parseArray(string);
                for(Object o : jsonArray){
                    if(gameAttribute1.getFieldName().trim().equals(JSONObject.parseObject(o.toString()).getString("value"))){
                        params.put("single4", JSONObject.parseObject(o.toString()).getString("key"));
                        break;
                    }
                }
            }else{
                params.put("single4","10548");
            }
            params.put("shotType", "ONESELF");
            params.put("goodsImg", goodsInfoAndAttrValueDto.getTitleImg());
//            String[] substring = goodsInfoAndAttrValueDto.getImgUrls().split(",");

            GoodsInfoImg goodsInfoImg = new GoodsInfoImg();
            goodsInfoImg.setGoodsId(goodsInfoAndAttrValueDto.getId());
            goodsInfoImg.setType(Constants.STR_1);
            List<GoodsInfoImg> infoImgs = goodsInfoImgMapper.selectGoodsInfoImgList(goodsInfoImg);
            List<String> list1 = infoImgs.stream().map(goodsInfoImg1 -> goodsInfoImg1.getImgUrl()).collect(Collectors.toList());

            if(list1.size()>20){
                list1 = list1.subList(0,20);
            }
            params.put("detailsImages", list1);
            params.put("detailsSingle5", null);
            params.put("single2", null);
            params.put("single3", null);
            params.put("pcIconUrl", goodsInfoAndAttrValueDto.getTitleImg());
        }
        if(goodsInfoAndAttrValueDto.getGameName().equals("永劫无间")){
            params.put("pcIconUrl", "https://pzdsoss.pzds.com/game/20230109/bXjrX8_1673234979433.png");
            params.put("shotType", "PZDS_OFFICIAL");
            params.put("shotRemark", null);
            params.put("gameId", 2);
            String regional = goodsInfoAndAttrValueDto.getGroupName();
            if(regional.equals("网易")){
                params.put("single1", 31);
                params.put("single6", 3792);
            }else if(regional.equals("Steam")){
                params.put("single1", 32);
                params.put("single6", 3794);
            }else {
                params.put("single1", 2531);
                params.put("single6", 3795);
            }
            params.put("detailsSingle1", 1294);
            params.put("detailsSingle2", 14017);
            params.put("detailsSingle3", 1463);
            params.put("detailsSingle4", 2586);
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF54())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF54()));
                if(gameAttribute1.getFieldName().equals("有换绑冷却")) {
                    params.put("single4", 12034);
                }else {
                    params.put("single4", 12035);
                }
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF55())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF55()));
                if(gameAttribute1.getFieldName().equals("未绑定")) {
                    params.put("single5", 13228);
                }else {
                    params.put("single5", 13229);
                }
            }
            if(goodsInfoAndAttrValueDto.getGroupName().equals("网易")) {
                if(goodsInfoAndAttrValueDto.getServerName().contains("手机")) {
                    params.put("single6", 3792);
                }else {
                    params.put("single6", 3793);
                }
            }else if(goodsInfoAndAttrValueDto.getGroupName().equals("Steam")){
                params.put("single6", 3794);
            }else {
                params.put("single6", 3795);
            }
        }
        if(goodsInfoAndAttrValueDto.getGameName().equals("和平精英")){
            params.put("gameId", 8);
            String regional = goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName();
            if(regional.equals("安卓QQ")){
                params.put("single1", 264);
            }else if(regional.equals("安卓微信")){
                params.put("single1", 266);
            }else if(regional.equals("苹果QQ")){
                params.put("single1", 265);
            }else {
                params.put("single1", 267);
            }
            params.put("detailsSingle1", 1331);
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF10())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF10()));
                if(gameAttribute1.getFieldName().equals("可二次实名")) {
                    params.put("single4", 2167);
                }else if(gameAttribute1.getFieldName().equals("包人脸")){
                    params.put("single4", 12136);
                }else {
                    params.put("single4", 2168);
                }
            }else {
                params.put("single4", 2168);
            }
            params.put("detailsSingle2", 12170);
            params.put("detailsSingle3", 13211);
            params.put("detailsSingle4", 13960);
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF13())) {
                params.put("detailsText3", goodsInfoAndAttrValueDto.getF13());
            }else {
                throw new GlobalException("营地号不能为空!!!");
            }
        }
        if(goodsInfoAndAttrValueDto.getGameName().equals("无畏契约")){
            params.put("gameId", 231);
            params.put("single1", 6406);
            params.put("single2", 6992);
            params.put("single4", 12478);
            params.put("single5", 12986);
            params.put("detailsSingle1", 12986);
            params.put("shotRemark", goodsInfoAndAttrValueDto.getDes());
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF1())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF1()));
                if(gameAttribute1.getFieldName().equals("可二次实名")) {
                    params.put("single6", 7607);
                }else {
                    params.put("single6", 7608);
                }
            }else {
                params.put("single6", 7608);
            }
            params.put("single7", 14047);
        }
        if(goodsInfoAndAttrValueDto.getGameName().equals("永劫无间手游")){
            params.put("gameId", 357);
            params.put("single1", 13215);
            if(goodsInfoAndAttrValueDto.getCarrierName().equals("网易手机")) {
                params.put("single2", 13216);
            }else {
                params.put("single2", 13217);
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF23())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF23()));
                if(gameAttribute1.getFieldName().equals("未绑定")) {
                    params.put("single4", 13230);
                }else {
                    params.put("single4", 13231);
                }
            }
            params.put("detailsSingle2", 13189);
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF35())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF35()));
                if(gameAttribute1.getFieldName().equals("有换绑冷却")) {
                    params.put("single5", 13233);
                }else {
                    params.put("single5", 13232);
                }
            }

            params.put("detailsSingle1", 13218);
        }
        if(goodsInfoAndAttrValueDto.getGameName().equals("金铲铲之战")){
            params.put("gameId", 25);
            String regional = goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName();
            if(regional.equals("安卓QQ")){
                params.put("single1", 1717);
            }else if(regional.equals("安卓微信")){
                params.put("single1", 1718);
            }else if(regional.equals("苹果QQ")){
                params.put("single1", 1716);
            }else {
                params.put("single1", 1715);
            }
            params.put("detailsSingle3", 13954);
            String pfIds = "";
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF6());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF7());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF8());
            List<GameAttribute> gameAttributs = getGameAttributs(pfIds);
            List list1 = new ArrayList();
            if(!CollectionUtils.isEmpty(gameAttributs)){
                String string = "[{\"key\":13101,\"value\":\"电玩竞技场\"},{\"key\":12137,\"value\":\"KDA强音之巅舞台\"},{\"key\":12138,\"value\":\"可可爱爱房间\"},{\"key\":12139,\"value\":\"香水宝石宫\"},{\"key\":12348,\"value\":\"云鹤仙观\"},{\"key\":12791,\"value\":\"2023全球总决赛百炼成金\"},{\"key\":12792,\"value\":\"无极剑境\"},{\"key\":12793,\"value\":\"魄罗水上乐园\"},{\"key\":13664,\"value\":\"喵喵妙妙窝\"}]\n";
                JSONArray jsonArray = JSONArray.parseArray(string);
                for(GameAttribute gameAttribute1 : gameAttributs){
                    for(Object o : jsonArray){
                        if(gameAttribute1.getFieldName().equals(JSONObject.parseObject(o.toString()).getString("value"))){
                            list1.add(JSONObject.parseObject(o.toString()).getString("key"));
                        }
                    }
                }
            }
            if(CollectionUtils.isEmpty(list1)) {
                list1.add("13198");
            }
            params.put("detailsCheckbox1", list1);

            List list2 = new ArrayList();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())){
                List<GameAttribute> gameAttributs1 = getGameAttributs(goodsInfoAndAttrValueDto.getF3());
                String string = "[{\"key\":13970,\"value\":\"至臻玉剑传说小小索拉卡\"},{\"key\":13971,\"value\":\"全球总决赛限定T1小小奥莉安娜\"},{\"key\":13972,\"value\":\"神凰行者小小萨勒芬妮\"}]\n";
                JSONArray jsonArray = JSONArray.parseArray(string);
                for(GameAttribute gameAttribute1 : gameAttributs1){
                    for(Object o : jsonArray){
                        if(gameAttribute1.getFieldName().equals(JSONObject.parseObject(o.toString()).getString("value"))){
                            list2.add(JSONObject.parseObject(o.toString()).getString("key"));
                        }
                    }
                }
            }
            if(CollectionUtils.isEmpty(list2)) {
                list2.add("13199");
            }
            params.put("detailsCheckbox2", list2);

            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF17())){
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF17()));
                String string = "[{\"key\":13726,\"value\":\"VIP11\"},{\"key\":13727,\"value\":\"VIP10\"},{\"key\":13728,\"value\":\"VIP9\"},{\"key\":13729,\"value\":\"VIP8\"},{\"key\":13730,\"value\":\"VIP7\"},{\"key\":13731,\"value\":\"VIP6\"},{\"key\":13732,\"value\":\"VIP5\"},{\"key\":13733,\"value\":\"VIP4\"},{\"key\":13734,\"value\":\"VIP3\"},{\"key\":13735,\"value\":\"VIP2\"},{\"key\":13736,\"value\":\"VIP1\"}]\n";
                JSONArray jsonArray = JSONArray.parseArray(string);
                for(Object o : jsonArray){
                    if(gameAttribute1.getFieldName().equals(JSONObject.parseObject(o.toString()).getString("value"))){
                        params.put("single5",JSONObject.parseObject(o.toString()).getString("key"));
                    }
                }
            }
            params.put("detailsSingle1", 1372);
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF1())){
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF1()));
                if(gameAttribute1.getFieldName().equals("可二次实名")){
                    params.put("detailsSingle2","7599");
                }else {
                    params.put("detailsSingle2","7600");
                }
            }else {
                params.put("detailsSingle2","7600");
            }
            params.put("single4", 5849);
        }
        if(goodsInfoAndAttrValueDto.getGameName().equals("暗区突围")){
            params.put("description",goodsInfoAndAttrValueDto.getDes());
            params.put("title",goodsInfoAndAttrValueDto.getTitle());
            params.put("gameId", 77);
            if(goodsInfoAndAttrValueDto.getSystemName().equals("安卓")){
                params.put("single1", 6723);
                if(goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")){
                    params.put("single2", 6725);
                }else {
                    params.put("single2", 6726);
                }
            }else {
                params.put("single1", 6724);
                if(goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")){
                    params.put("single2", 6727);
                }else {
                    params.put("single2", 6728);
                }
            }
            params.put("detailsSingle2", 13949);
            params.put("shotType", "ONESELF");
            params.put("goodsImg", goodsInfoAndAttrValueDto.getTitleImg());

            GoodsInfoImg goodsInfoImg = new GoodsInfoImg();
            goodsInfoImg.setGoodsId(goodsInfoAndAttrValueDto.getId());
            goodsInfoImg.setType(Constants.STR_1);
            List<GoodsInfoImg> infoImgs = goodsInfoImgMapper.selectGoodsInfoImgList(goodsInfoImg);
            List<String> list1 = infoImgs.stream().map(goodsInfoImg1 -> goodsInfoImg1.getImgUrl()).collect(Collectors.toList());

            if(list1.size()>20){
                list1 = list1.subList(0,20);
            }
            params.put("detailsImages", list1);
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())){
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
                if(gameAttribute1.getFieldName().equals("可二次实名")){
                    params.put("detailsSingle1","7603");
                }else {
                    params.put("detailsSingle1","7604");
                }
            }else {
                params.put("detailsSingle1","7604");
            }
        }
        if(goodsInfoAndAttrValueDto.getGameName().equals("三角洲行动")){
            params.put("shotType","THIRD_SHOT");
            params.put("sellMethod",null);
            params.put("serviceType","CONFIDENCE_BUY");
            params.put("gameId", 391);
            params.put("single1", 13851);
            if(goodsInfoAndAttrValueDto.getCarrierName().equals("QQ")) {
                params.put("single2", 13852);
            }else {
                params.put("single2", 13853);
            }
            params.put("detailsSingle2", 13976);
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF7())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF7()));
                if(gameAttribute1.getFieldName().equals("可二次实名")) {
                    params.put("single4", 13200);
                }else {
                    params.put("single4", 13201);
                }
            }else {
                params.put("single4", 13200);
            }
            params.put("detailsSingle1", 13202);
        }
        if (goodsInfoAndAttrValueDto.getGameName().equals("使命召唤手游")) {
            params.remove("edit");
            params.put("shotType", "PZDS_OFFICIAL");
            params.put("pcIconUrl", "https://pzdsoss.pzds.com/game/20230531/HwkpMN_1685528839185.png");
            params.put("gameId", 55);
            params.put("gameName", "使命召唤手游");
            params.put("detailsSingle1", 13724);
            params.put("detailsSingle2", 13962);
            String regional = goodsInfoAndAttrValueDto.getSystemName() + goodsInfoAndAttrValueDto.getCarrierName();
            if (regional.equals("安卓QQ")) {
                params.put("single1", 3725);
            } else if (regional.equals("安卓微信")) {
                params.put("single1", 3726);
            } else if (regional.equals("苹果QQ")) {
                params.put("single1", 3727);
            } else {
                params.put("single1", 3728);
            }
            params.put("single2", "null");
            params.put("single3", "null");
            params.put("single4", 3722);
            if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())) {
                GameAttribute gameAttribute1 =
                        gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
                if (gameAttribute1.getFieldName().equals("可改实名")) {
                    params.put("single5", 3723);
                    params.put("single7", 5853);
                } else {
                    params.put("single5", 3724);
                    params.put("single7", 5854);
                }
            } else {
                params.put("single5", 3724);
                params.put("single7", 5854);
            }
            if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF6())) {
                GameAttribute gameAttribute1 =
                        gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF6()));
                String dws = "[{\"key\":3729,\"value\":\"无\"},{\"key\":3730,\"value\":\"青铜\"},{\"key\":3731," +
                        "\"value\":\"白银\"},{\"key\":3732,\"value\":\"黄金\"},{\"key\":3733,\"value\":\"铂金\"}," +
                        "{\"key\":3734,\"value\":\"钻石\"},{\"key\":3735,\"value\":\"大师\"},{\"key\":3736," +
                        "\"value\":\"战神\"},{\"key\":3737,\"value\":\"传奇战神\"}]\n";
                JSONArray jsonArray = JSONArray.parseArray(dws);
                for (Object o : jsonArray) {
                    if (gameAttribute1.getFieldName().contains(JSONObject.parseObject(o.toString()).getString("value"))) {
                        params.put("single6", JSONObject.parseObject(o.toString()).getString("key"));
                    }
                }
            } else {
                params.put("single6", 3729);
            }
        }
        action.put("action",params);
        return action;
    }

    @Override
    public AjaxResult addGame(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner salePartner) {
        Map<String, Object> params = params(goodsInfoAndAttrValueDto, salePartner);
        String paramsStr = JSONObject.toJSONString(params);
        log.info("盼之新增请求参数={}", paramsStr);
//        String token = commonApi.loginPanzhi(salePartner);

        String token = getToken(salePartner);

        // 生成 随机数 并生成sign  注意 &2147483647         &accessKey=3qXyB7uf
        StringBuilder sb = new StringBuilder();
        long PZTimestamp = System.currentTimeMillis();
        String Random = getRanString();
        String sign = getSign(PZTimestamp, Random, params);
//        System.out.println("sign:" + sign);
        String response = httpPostExecute("https://api.pzds.com/api/web-client/v2/userCenter/saveGoods",
                PZTimestamp, Random, sign, token, params);
        log.info("盼之新增返回参数={}", response);

        if (response.contains("请先通过发布安全校验")){
            //发送验证
            //当前接口停止推送
            SelectPush selectPush = selectPushMapper.selectSelectPushByConfig(salePartner.getId().toString(), "0");
            selectPush.setType("111100000");
            selectPushMapper.updateSelectPush(selectPush);

            //发送验证 尝试3次
            int times = 1;
            int interval = 20;
            for (int i = 0; i < times; i++) {
                try {
                    String smd = smd(salePartner);
//                    JSONObject jsonObject = JSONObject.parseObject(smd);
//                    Boolean success = jsonObject.getBoolean("success");
//                    if (success) {
//                        String redisKey = "panzhiToken";
//                        redisCache.setCacheObject(redisKey, selectPush, DateUtils.getTimeOut(), TimeUnit.SECONDS);
//                        Thread.sleep(interval * 1000);
//                        break;
//                    }
//                    Thread.sleep(interval * 1000);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }

        String data1 = JSONObject.parseObject(response).getString("data");

        JSONObject resultJson = JSONObject.parseObject(response);
        Map<String, Object> result = new HashMap<>();
        if (!"SUCCESS".equals(resultJson.getString("code"))) {
            result.put("code", 500);
        } else {
            result.put("code", 200);
            String goodsNo = JSONObject.parseObject(data1).getString("goodsNo");
//            commit(goodsNo,token);
            String data = resultJson.getString("data");

            //{"success":true,"code":"SUCCESS","info":"操作成功","data":{"goodsNo":"C2476813","needAuth":false},"requestId":"6e6401cef25746b984040a8bce4ec0a9.435.17200603265679381"}

            result.put("outId", goodsNo);
            ArtRec artRecreq = new ArtRec();
            artRecreq.setConfig(salePartner.getId());
            artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
            List<ArtRec> artRecs = artRecMapper.selectArtRecList(artRecreq);
            if (artRecs.size() > 0) {
                artRecs.get(0).setOutid(JSONObject.parseObject(data).getString("goodsNo"));
                artRecMapper.updateArtRec(artRecs.get(0));
            } else {
                artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
                artRecreq.setCreateId(goodsInfoAndAttrValueDto.getCreateId());
                artRecreq.setType(LCConstant.interAdd);
                artRecreq.setConfig(salePartner.getId());
                artRecreq.setSaleCode(salePartner.getSaleName());
                artRecreq.setOutid(JSONObject.parseObject(data).getString("goodsNo"));
                artRecMapper.insertArtRec(artRecreq);
            }
        }
        result.put("req", JSONObject.toJSONString(params));
        result.put("res", response);
        result.put("msg", resultJson);
        return AjaxResult.success(result);
    }




    /**
     * 获取盼之验证码
     *
     * @param salePartner
     * @return
     */
    public String smd(SalePartner salePartner) {
        String token = getToken(salePartner);

        Map<String, Object> params = new HashMap<>();

        JSONObject action = new JSONObject();
        action.put("phone", salePartner.getSaleKey());
        action.put("smsTemplate", "CHECK");

        params.put("action", action);

        // 生成 随机数 并生成sign  注意 &2147483647         &accessKey=3qXyB7uf
        long PZTimestamp = System.currentTimeMillis();
        String Random = getRanString();
        String sign = getSign(PZTimestamp, Random, params);
//        String response = httpPostExecute("https://api.pzds.com/api/web-client/v2/public/common/sms",
//                PZTimestamp, Random, sign, token, params);
        String response = HttpRequest.post("https://api.pzds.com/api/web-client/v2/public/common/sms")
                .header("Accept", "application/json, text/plain, */*")
                .header("Accept-Language", "zh-CN,zh;q=0.9")
                .header("Cache-Control", "no-cache")
                .header("Connection", "keep-alive")
                .header("Content-Type", "application/json")
                .header("Origin", "https://www.pzds.com")
                .header("PZOs", "windows")
                .header("PZPlatform", "pc")
                .header("PZTimestamp", String.valueOf(PZTimestamp))
                .header("PZVersion", "1.0.0")
                .header("PZVersionCode", "1")
                .header("PZid", "100342249")
                .header("Pragma", "no-cache")
                .header("Random", Random)
                .header("Referer", "https://www.pzds.com/")
                .header("Sec-Fetch-Dest", "empty")
                .header("Sec-Fetch-Mode", "cors")
                .header("Sec-Fetch-Site", "same-site")
                .header("Sign", sign)
                .header("Skey", "CLIENT")
                .header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36")
                .header("channelInfo", "{\"channelCode\":null,\"tag\":null,\"channelType\":null,\"searchWord\":\"null\"}")
                .header("sec-ch-ua", "\"Chromium\";v=\"134\", \"Not:A-Brand\";v=\"24\", \"Google Chrome\";v=\"134\"")
                .header("sec-ch-ua-mobile", "?0")
                .header("sec-ch-ua-platform", "\"Windows\"")
                .header("token", token)
                .header("x-oss-forbid-overwrite", "true").body(JSONObject.toJSONString(params, SerializerFeature.WriteMapNullValue)).execute().body();
        log.info("盼之短信返回参数={}", response);
        return response;

    }
    /**
     * 封装发送方法
     *
     * @param url
     * @param PZTimestamp
     * @param Random
     * @param sign
     * @param token
     * @param params
     * @return
     */
    public String httpPostExecute(String url, long PZTimestamp, String Random, String sign, String token,
                                  Map<String, Object> params) {
        return HttpRequest.post(url).header("Accept", "application/json, text/plain, */*")
                .header("Accept-Language", "zh-CN,zh;q=0.9")
                .header("Connection", "keep-alive")
                .header("Content-Type", "application/json;charset=UTF-8")
//                    .header("Cookie", "")
                .header("Origin", "https://www.pzds.com")
                .header("PZOs", "windows")
                .header("PZid", "100342249")
                .header("PZPlatform", "pc")
                .header("PZTimestamp", String.valueOf(PZTimestamp))
                .header("PZVersion", "1.0.0")
                .header("PZVersionCode", "1")
                .header("Random", Random)
                .header("Referer", "https://www.pzds.com/")
                .header("sign", sign)
                .header("Skey", "CLIENT")
                .header("channelInfo", "{\"channelCode\":null,\"tag\":null,\"channelType\":null,\"searchWord\":\"null\"}")
                .header("Token", token)
                .header("sec-ch-ua-mobile", "?0")
                .header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36")
                .body(JSONObject.toJSONString(params, SerializerFeature.WriteMapNullValue)).execute().body();
    }

    /**
     * 获取sign
     *
     * @param PZTimestamp
     * @param Random
     * @param action
     * @return
     */
    String getSign(long PZTimestamp, String Random, Map<String, Object> action) {
        StringBuilder sb = new StringBuilder();
        String guDingZhiAndAccessKey = getGuDingZhiAndAccessKey();
        String[] split = guDingZhiAndAccessKey.split(",");
        sb.append("PZTimestamp=");
        sb.append(PZTimestamp);
        sb.append("&Random=");
        sb.append(Random);
        sb.append("&" + split[0] + "=");
        sb.append(JSONObject.toJSONString(action, SerializerFeature.WriteMapNullValue));
        sb.append("&accessKey=" + split[1]);
        String b = sb.toString();
        try {
            b = URLEncoder.encode(b, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        b = b.replace("%26", "&");
        b = b.replace("%3D", "=");
        b = b.replaceAll("\\(", "%28");
        b = b.replaceAll("\\)", "%29");
        b = b.replaceAll("'", "%27");
        b = b.replaceAll("\\*", "%2A");
        b = b.replaceAll("~", "%7E");
        b = b.replaceAll("!|！", "%21");
        b = b.replaceAll("\\+", "%20");
        return DigestUtils.md5Hex(b);
    }
    /**
     * 获取固定值和AccessKey
     *
     * @return
     */
    String getGuDingZhiAndAccessKey() {
//        String gudingzhi = null;
//        String accessKey = null;
//        try {
//            Object cacheObjectgdz = redisCache.getCacheObject(Constants.PZgudingzhi);
//            Object cacheObjectak = redisCache.getCacheObject(Constants.PZaccessKey);
//            if (Objects.isNull(cacheObjectgdz) || Objects.isNull(cacheObjectak)) {
//                String domain = "https://www.pzds.com/";
//                Document document = Jsoup.connect(domain + "login").get();
//                // 使用CSS选择器获取指定的HTML元素
//                Elements scripts = document.select("script[src]");
//                String jsUrl = null;
//                for (Element script : scripts) {
//                    String src = script.attr("src");
//                    String body = HttpRequest.get(src).execute().body();
//                    if (body.contains("&accessKey")) {
////                        System.out.println("src:" + src);
//                        jsUrl = src;
//                        break;
//                    }
//                }
//                //获取js内容
//                String body = HttpRequest.get(jsUrl).execute().body();
//                //获取accessKey
//                accessKey = getJieQuStr(body, "&accessKey=", '"');
//                //获取固定值的那一行
//                String jieQuStr = getJieQuStr(body, "&Random=", ':');
//                //获取固定值
//                gudingzhi = getJieQuStr(jieQuStr, "&", '=');
//                if (StringUtils.isEmpty(accessKey) || StringUtils.isEmpty(gudingzhi)) {
//                    gudingzhi = "2147483647";
//                    accessKey = "3qXyB7uf";
//                }
//                redisCache.setCacheObject(Constants.PZgudingzhi, gudingzhi, 1, TimeUnit.DAYS);
//                redisCache.setCacheObject(Constants.PZaccessKey, accessKey, 1, TimeUnit.DAYS);
//            } else {
//                gudingzhi = cacheObjectgdz.toString();
//                accessKey = cacheObjectak.toString();
//            }
//        } catch (Exception e) {
//
//        }
        String gudingzhi = "2147483647";
        String accessKey = "3qXyB7uf";
        return gudingzhi + "," + accessKey;
    }


    @Override
    public AjaxResult editGame(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner sa) {
        Map<String, Object> params = new HashMap<>();
        Map<String, Object> action = new TreeMap<>();
        if(goodsInfoAndAttrValueDto.getGameName().equals("原神")) {
            params.put("gameId", "12");
        }else if(goodsInfoAndAttrValueDto.getGameName().contains("崩坏")){
            params.put("gameId", "213");
        }else if(goodsInfoAndAttrValueDto.getGameName().contains("王者荣耀")){
            params.put("gameId", "7");
        }else if(goodsInfoAndAttrValueDto.getGameName().equals("英雄联盟")){
            params.put("gameId", "6");
        }else if(goodsInfoAndAttrValueDto.getGameName().contains("穿越火线")){
            params.put("gameId", "16");
        }else if(goodsInfoAndAttrValueDto.getGameName().equals("英雄联盟(手游)")){
            params.put("gameId", "17");
        }else if(goodsInfoAndAttrValueDto.getGameName().equals("永劫无间")){
            params.put("gameId", "2");
        }else if(goodsInfoAndAttrValueDto.getGameName().equals("和平精英")){
            params.put("gameId", "8");
        }else if(goodsInfoAndAttrValueDto.getGameName().equals("无畏契约")){
            params.put("gameId", "231");
        }else if(goodsInfoAndAttrValueDto.getGameName().equals("永劫无间手游")){
            params.put("gameId", "357");
        }else if(goodsInfoAndAttrValueDto.getGameName().equals("金铲铲之战")){
            params.put("gameId", "25");
        }else if(goodsInfoAndAttrValueDto.getGameName().equals("三角洲行动")){
            params.put("gameId", "391");
        }
        //获取三方id
        ArtRec artRecreq = new ArtRec();
        artRecreq.setConfig(sa.getId());
        artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
        List<ArtRec> artRecs = artRecMapper.selectArtRecList(artRecreq);
        ArtRec artRec = null;
        if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(artRecs)) {
            artRec = artRecs.get(0);
        }
        if (Objects.isNull(artRec) || StringUtils.isEmpty(artRec.getOutid())) {
            throw new GlobalException("当前账号未上架!!!");
        }

        params.put("goodsCatalogueId", "6");
        params.put("goodsNo", artRec.getOutid());
//        BigDecimal bigDecimal = commonApi.addPrice(goodsInfoAndAttrValueDto.getPrice(), sa.getSeleep());
        params.put("price",goodsInfoAndAttrValueDto.getPrice().toPlainString());
        action.put("action", params);
        Map<String, Object> result = new HashMap<>();
        // 生成 随机数 并生成sign  注意 &2147483647         &accessKey=3qXyB7uf
        String token = getToken(sa);
        long PZTimestamp = System.currentTimeMillis();
        String Random = getRanString();
        String sign = getSign(PZTimestamp, Random, action);
        String response = httpPostExecute("https://api.pzds.com/api/web-client/v2/userCenter/updatePrice",
                PZTimestamp, Random, sign, token, action);
        log.info("盼之新增返回参数={}", response);
        JSONObject resultJson = JSONObject.parseObject(response);
        if (!"SUCCESS".equals(resultJson.getString("code"))) {
            result.put("code", 500);
        } else {
            result.put("code", 200);
        }
        result.put("req", JSONObject.toJSONString(params));
        result.put("res", response);
        result.put("msg", resultJson);
        return AjaxResult.success(result);
    }

    @Override
    public AjaxResult delGame(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner sa) {

        Map<String, Object> result = new HashMap<>();


        Map<String, Object> params = new HashMap<>();
        Map<String, Object> action = new HashMap<>();
        //获取三方id
        ArtRec artRecreq = new ArtRec();
        artRecreq.setConfig(sa.getId());
        artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
        List<ArtRec> artRecs = artRecMapper.selectArtRecList(artRecreq);
        ArtRec artRec = null;
        if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(artRecs)) {
            artRec = artRecs.get(0);
        }
        if (Objects.isNull(artRec) || StringUtils.isEmpty(artRec.getOutid())) {
            throw new GlobalException("当前账号未上架!!!");
        }
        //下架
        params.put("goodsNo", artRec.getOutid());
        params.put("status", "ONESELF_DOWN_STAND");
        action.put("action", params);
        // 生成 随机数 并生成sign  注意 &2147483647         &accessKey=3qXyB7uf
        long PZTimestamp = System.currentTimeMillis();
        String Random = getRanString();
        String sign = getSign(PZTimestamp, Random, action);
        String token = getToken(sa);
        String response = "";
        try {
            //先调下架
            response = httpPostExecute("https://api.pzds.com/api/web-client/v2/userCenter/updateStatus",
                    PZTimestamp, Random, sign, token, action);
            String success = JSONObject.parseObject(response).getString("success");
            if(success.equals("true")){
                result.put("code", 200);
                //再调删除
                params = new HashMap<>();
                action = new TreeMap<>();
                params.put("goodsNo", artRec.getOutid());
                action.put("action", params);
                // 生成 随机数 并生成sign  注意 &2147483647         &accessKey=3qXyB7uf
                PZTimestamp = System.currentTimeMillis();
                Random = getRanString();
                sign = getSign(PZTimestamp, Random, action);
                try {
                    response = httpPostExecute("https://api.pzds.com/api/web-client/v2/userCenter/deleteGoods",
                            PZTimestamp, Random, sign, token, action);
                } catch (Exception e) {
                    result.put("code", 500);
                }
            }else {
                result.put("code", 500);
            }
        } catch (Exception e) {
            result.put("code", 500);
        }
        result.put("req", JSONObject.toJSONString(params));
        result.put("res", response);
        result.put("msg", response);
        return AjaxResult.success(result);
    }

    private List<GameAttribute> getGameAttributs(String ids) {
        if (StringUtils.isEmpty(ids)) {
            return new ArrayList<>();
        }
        return gameAttributeMapper.selectGameAttributeListByIds((Long[]) ConvertUtils.convert(ids.split(","),
                Long.class));
    }

    private String reIds(String allIds, String ids) {
        if (StringUtils.isNotEmpty(ids)) {
            if (StringUtils.isNotEmpty(allIds)) {
                allIds = allIds + "," + ids;
            } else {
                allIds = ids;
            }
        }
        return allIds;
    }
//    public static String add() {
//        Map<String,Object> params = new HashMap<>();
//        Map<String,Object> action = new HashMap<>();
//        params.put("accountSource","ORIGINAL_USER");
//        params.put("bargain",true);
//        params.put("buyConfidenceBuy",false);
//        params.put("compensation",true);
//        params.put("description","204皮肤-4神话-22传说-97史诗-111英雄-详情看图 龙的传人 灰烬骑士派克 星之守护者阿狸永绽盛芒 摄魂使者薇恩 战斗学院EZ白金学长 水晶玫瑰 嘉文四世 星域游侠崔斯特 神王德莱厄斯 神王盖伦 福牛守护者厄运小姐");
//        params.put("detailsCheckbox1",new ArrayList<>());
//        params.put("detailsImages",new String[]{"https://pzdsoss.pzds.com/goods/detail/20240327/CGJ3eh_1711508620572.jpeg"});
//        params.put("detailsSection1","2000");
//        params.put("detailsSingle1",1355);
//        params.put("detailsSingle2",7595);
//        params.put("detailsSingle5",null);
//        params.put("edit",false);
//        params.put("gameAccount","3551539576");
//        params.put("gameCatalogueId",null);
//        params.put("gameId",17);
//        params.put("gameName","英雄联盟手游");
//        params.put("gameSecret","qaz240944");
//        params.put("gameSecretRes","qaz240944");
//        params.put("goodsCatalogueId","6");
//        params.put("goodsImg","https://imgv2.zuyoul.com/2c97e7c98e6a4cc7018e7bb9c02d29e9.jpg");
//        params.put("goodsNo",null);
//        params.put("isXiaomiTransfer",false);
//        params.put("linkPhone","17344124999");
//        params.put("linkQq","17344124999");
//        params.put("linkWx","17344124999");
//        params.put("pcIconUrl","https://imgv2.zuyoul.com/2c97e7c98e6a4cc7018e7bb9c02d29e9.jpg");
//        params.put("price","1650");
//        params.put("sellMethod","ONLY_SELL");
//        params.put("shotRemark",null);
//        params.put("shotType","ONESELF");
//        params.put("single1",945);
//        params.put("single2",null);
//        params.put("single3",null);
//        params.put("single4","10555");
//        params.put("title","204皮肤-4神话-22传说-97史诗-111英雄-详情看图 龙的传人 灰烬骑");
//        action.put("action",params);
//        String paramsStr = JSONObject.toJSONString(action);
//        log.info("盼之新增请求参数={}", paramsStr);
//        SalePartner salePartner = new SalePartner();
//        salePartner.setSaleKey("17344124999");
//        salePartner.setOther("aa120120");
//        String token = login(salePartner);
//        String response = HttpRequest.post("https://api.pzds.com/api/web-client/v2/userCenter/saveGoods").header("Token",token).body(JSONObject.toJSONString(action)).execute().body();
//        log.info("盼之新增返回参数={}", response);
//        String data1 = JSONObject.parseObject(response).getString("data");
//        System.out.println(response);
//        return response;
//    }

    public static String getRanString() {
        Random random = new Random();
        //把随机生成的数字转成字符串
        String str = String.valueOf(random.nextInt(9));
        for (int i = 0; i < 5; i++) {
            str += random.nextInt(9);
        }
        if (str.startsWith("0")) {
            str = str.replaceFirst("0", "1");
        }
        return str;
    }

    public static void main(String[] args) {
        SalePartner salePartner = new SalePartner();
        salePartner.setSaleKey("15225247351");
        salePartner.setOther("Qwer..0011");
        String login = loginPanzhi(salePartner);
        while (true) {
            try {
                String string = pzList(login);
                String records = JSONObject.parseObject(string).getString("records");
                JSONArray jsonArray = JSONArray.parseArray(records);
                for (Object o : jsonArray) {
                    String goodsNo = JSONObject.parseObject(o.toString()).getString("goodsNo");
                    Map<String, Object> params = new HashMap<>();
                    Map<String, Object> action = new HashMap<>();
                    //下架
                    params.put("goodsNo", goodsNo);
                    params.put("status", "ONESELF_DOWN_STAND");
                    action.put("action", params);
                    // 生成 随机数 并生成sign  注意 &2147483647         &accessKey=3qXyB7uf
                    StringBuilder sb = new StringBuilder();
                    long PZTimestamp = System.currentTimeMillis();
                    String Random = getRanString();
                    sb.append("PZTimestamp=");
                    sb.append(PZTimestamp);
                    sb.append("&Random=");
                    sb.append(Random);
                    sb.append("&2147483647=");
                    sb.append(JSONObject.toJSON(action));
                    sb.append("&accessKey=3qXyB7uf");
                    System.out.println(sb.toString());
                    String b = sb.toString();
                    try {
                        b = URLEncoder.encode(b, "UTF-8");
                    } catch (UnsupportedEncodingException e) {
                        e.printStackTrace();
                    }
                    b = b.replace("%26", "&");
                    b = b.replace("%3D", "=");
                    b = b.replaceAll("\\(", "%28");
                    b = b.replaceAll("\\)", "%29");
                    b = b.replaceAll("'", "%27");
                    b = b.replaceAll("\\*", "%2A");
                    b = b.replaceAll("~", "%7E");
                    b = b.replaceAll("!|！", "%21");
                    String sign = DigestUtils.md5Hex(b);
                    //开始拼装请求
                    String response = HttpRequest.post("https://api.pzds.com/api/web-client/v2/userCenter/updateStatus").header("Accept", "application/json, text/plain, */*")
                            .header("PZTimestamp", String.valueOf(PZTimestamp))
                            .header("Content-Type", "application/json;charset=UTF-8")
                            .header("Origin", "https://www.pzds.com")
                            .header("PZPlatform", "pc")
                            .header("PZVersion", "1.0.0")
                            .header("PZVersionCode", "1")
                            .header("Random", Random)
                            .header("Referer", "https://www.pzds.com/")
                            .header("Sign", sign)
                            .header("Token", login)
                            .header("sec-ch-ua-mobile", "?0")
                            .header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like " +
                                    "Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123 .0.0.0")
                            .body(JSONObject.toJSONString(action)).execute().body();

                    //删除
                    params = new HashMap<>();
                    action = new HashMap<>();
                    params.put("goodsNo", goodsNo);
                    action.put("action", params);
                    Thread.sleep(1000l);
                    // 生成 随机数 并生成sign  注意 &2147483647         &accessKey=3qXyB7uf
                    sb = new StringBuilder();
                    PZTimestamp = System.currentTimeMillis();
                    Random = getRanString();
                    sb.append("PZTimestamp=");
                    sb.append(PZTimestamp);
                    sb.append("&Random=");
                    sb.append(Random);
                    sb.append("&2147483647=");
                    sb.append(JSONObject.toJSON(action));
                    sb.append("&accessKey=3qXyB7uf");
                    System.out.println(sb.toString());
                    b = sb.toString();
                    try {
                        b = URLEncoder.encode(b, "UTF-8");
                    } catch (UnsupportedEncodingException e) {
                        e.printStackTrace();
                    }
                    b = b.replace("%26", "&");
                    b = b.replace("%3D", "=");
                    b = b.replaceAll("\\(", "%28");
                    b = b.replaceAll("\\)", "%29");
                    b = b.replaceAll("'", "%27");
                    b = b.replaceAll("\\*", "%2A");
                    b = b.replaceAll("~", "%7E");
                    b = b.replaceAll("!|！", "%21");
                    sign = DigestUtils.md5Hex(b);
                    //开始拼装请求
                    response = HttpRequest.post("https://api.pzds.com/api/web-client/v2/userCenter/deleteGoods").header("Accept", "application/json, text/plain, */*")
                            .header("PZTimestamp", String.valueOf(PZTimestamp))
                            .header("Content-Type", "application/json;charset=UTF-8")
                            .header("Origin", "https://www.pzds.com")
                            .header("PZPlatform", "pc")
                            .header("PZVersion", "1.0.0")
                            .header("PZVersionCode", "1")
                            .header("Random", Random)
                            .header("Referer", "https://www.pzds.com/")
                            .header("Sign", sign)
                            .header("Token", login)
                            .header("sec-ch-ua-mobile", "?0")
                            .header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like " +
                                    "Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123 .0.0.0")
                            .body(JSONObject.toJSONString(action)).execute().body();
                    System.out.println(response);
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    static String pzList(String token){
        String url = "https://api.pzds.com/api/web-client/v2/userCenter/pageGoods";
        Map<String,Object> params = new HashMap<>();
        Map<String,Object> action = new HashMap<>();
        action.put("page",1);
        action.put("pageSize",10);
        params.put("status","ON_STAND");

        action.put("action",params);
        // 生成 随机数 并生成sign  注意 &2147483647         &accessKey=3qXyB7uf
        StringBuilder sb = new StringBuilder();
        long PZTimestamp = System.currentTimeMillis();
        String Random = getRanString();
        sb.append("PZTimestamp=");
        sb.append(PZTimestamp);
        sb.append("&Random=");
        sb.append(Random);
        sb.append("&2147483647=");
        sb.append(JSONObject.toJSON(action));
        sb.append("&accessKey=3qXyB7uf");
        System.out.println(sb.toString());
        String b = sb.toString();
        try {
            b = URLEncoder.encode(b, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        b = b.replace("%26", "&");
        b = b.replace("%3D", "=");
        b = b.replaceAll("\\(", "%28");
        b = b.replaceAll("\\)", "%29");
        b = b.replaceAll("'", "%27");
        b = b.replaceAll("\\*", "%2A");
        b = b.replaceAll("~", "%7E");
        b = b.replaceAll("!|！", "%21");
        String sign = DigestUtils.md5Hex(b);
        //开始拼装请求
        String response = HttpRequest.post("https://api.pzds.com/api/web-client/v2/userCenter/pageGoods").header("Accept", "application/json, text/plain, */*")
                .header("PZTimestamp", String.valueOf(PZTimestamp))
                .header("Content-Type", "application/json;charset=UTF-8")
                .header("Origin", "https://www.pzds.com")
                .header("PZPlatform", "pc")
                .header("PZVersion", "1.0.0")
                .header("PZVersionCode", "1")
                .header("Random", Random)
                .header("Referer", "https://www.pzds.com/")
                .header("Sign", sign)
                .header("Token", token)
                .header("sec-ch-ua-mobile", "?0")
                .header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like " +
                        "Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123 .0.0.0")
                .body(JSONObject.toJSONString(action)).execute().body();
        return JSONObject.parseObject(response).getString("data");
    }

//    public String getToken(){
//
//        Object panzhiToken = redisCache.getCacheObject("panzhiToken");
//        System.out.println(panzhiToken);
//        return panzhiToken.toString();
//
//    }
    /**
     * 获取token
     *
     * @param salePartner
     * @return
     */
    public String getToken(SalePartner salePartner) {
        String token = null;
        String tokenKey = "panzhiTokens";
//        Object cacheObject = redisCache.getCacheObject(tokenKey);
//        if (Objects.isNull(cacheObject)) {
            String url = "https://api.pzds.com/api/web-client/v2/user/public/login/password";
            Map<String, Object> params = new LinkedHashMap<>();
            Map<String, Object> action = new HashMap<>();
            params.put("phone", salePartner.getSaleKey());
            String string = DigestUtils.md5Hex(salePartner.getOther());
            params.put("password", string);
            params.put("openId", null);
            params.put("thirdType", null);
            params.put("unionId", null);
            action.put("action", params);

            // 生成 随机数 并生成sign  注意 &2147483647         &accessKey=3qXyB7uf
            long PZTimestamp = System.currentTimeMillis();
            String Random = getRanString();
            String sign = getSign(PZTimestamp, Random, action);
            //开始拼装请求
            String body = HttpRequest.post(url).header("Accept", "application/json, text/plain, */*")
                    .header("Accept-Language", "zh-CN,zh;q=0.9")
                    .header("Connection", "keep-alive")
                    .header("Content-Type", "application/json;charset=UTF-8")
//                    .header("Cookie", "")
                    .header("Origin", "https://www.pzds.com")
                    .header("PZOs", "windows")
                    .header("PZPlatform", "pc")
                    .header("PZTimestamp", String.valueOf(PZTimestamp))
                    .header("PZVersion", "1.0.0")
                    .header("PZVersionCode", "1")
                    .header("Random", Random)
                    .header("Referer", "https://www.pzds.com/")
                    .header("sign", sign)
                    .header("Skey", "CLIENT")
                    .header("channelInfo", "{\"channelCode\":null,\"tag\":null,\"channelType\":null," +
                            "\"searchWord\":\"null\"}")
                    .header("sec-ch-ua-mobile", "?0")
                    .header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like " +
                            "Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123 .0.0.0")
                    .body(JSONObject.toJSONString(action, SerializerFeature.WriteMapNullValue)).execute().body();
            token = JSONObject.parseObject(body).getString("data");
//            redisCache.setCacheObject(tokenKey, token, DateUtils.getTimeOut(), TimeUnit.SECONDS);
//        } else {
//            token = cacheObject.toString();
//        }
        if (Objects.isNull(token)) {
            throw new GlobalException("未登录成功");
        }
        return token;
    }

//    public static String panzhiList(SalePartner salePartner){
//
//        String url = "https://api.pzds.com/api/web-client/v2/userCenter/pageGoods";
//        Map<String, Object> params = new HashMap<>();
//        Map<String, Object> action = new HashMap<>();
//        params.put("status", "ON_STAND");
//        action.put("action", params);
//        action.put("page", 1);
//        action.put("pageSize", 10);
//
//        // 生成 随机数 并生成sign  注意 &2147483647         &accessKey=3qXyB7uf
//        StringBuilder sb = new StringBuilder();
//        long PZTimestamp = System.currentTimeMillis();
//        String Random = getRanString();
//        sb.append("PZTimestamp=");
//        sb.append(PZTimestamp);
//        sb.append("&Random=");
//        sb.append(Random);
//        sb.append("&2147483647=");
//        sb.append(JSONObject.toJSON(action));
//        sb.append("&accessKey=3qXyB7uf");
//        System.out.println(sb.toString());
//        String b = sb.toString();
//        try {
//            b = URLEncoder.encode(b, "UTF-8");
//        } catch (UnsupportedEncodingException e) {
//            e.printStackTrace();
//        }
//        b = b.replace("%26", "&");
//        b = b.replace("%3D", "=");
//        b = b.replaceAll("\\(", "%28");
//        b = b.replaceAll("\\)", "%29");
//        b = b.replaceAll("'", "%27");
//        b = b.replaceAll("\\*", "%2A");
//        b = b.replaceAll("~", "%7E");
//        b = b.replaceAll("!|！", "%21");
//        String sign = DigestUtils.md5Hex(b);
//        //开始拼装请求
//        String body = HttpRequest.post(url).header("Accept", "application/json, text/plain, */*")
//                .header("PZTimestamp", String.valueOf(PZTimestamp))
//                .header("Content-Type", "application/json;charset=UTF-8")
//                .header("Origin", "https://www.pzds.com")
//                .header("PZPlatform", "pc")
//                .header("PZVersion", "1.0.0")
//                .header("PZVersionCode", "1")
//                .header("Random", Random)
//                .header("Referer", "https://www.pzds.com/")
//                .header("sign", sign)
//                .header("Token", commonApi.loginPanzhi(salePartner))
//                .header("sec-ch-ua-mobile", "?0")
//                .header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like " +
//                        "Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123 .0.0.0")
//                .body(JSONObject.toJSONString(action)).execute().body();
//        return body;
//    }



    static String getArea(String token,String gameId){
        String url = "https://api.pzds.com/api/web-client/v2/userCenter/treeGameProperTies";
        Map<String,Object> params = new HashMap<>();
        Map<String,Object> action = new HashMap<>();
        params.put("gameId",gameId);
        params.put("goodsCatalogueId",6);
        action.put("action",params);
        String body = HttpRequest.post(url)
                .header("Token",token)
                .body(JSONObject.toJSONString(action)).execute().body();
        return JSONObject.parseObject(body).getString("data");
    }
    static String getOptions(String token,String gameId){
        String url = "https://api.pzds.com/api/web-client/v2/userCenter/listGoodsPropertyConfig";
        Map<String,Object> params = new HashMap<>();
        Map<String,Object> action = new HashMap<>();
        params.put("gameId",gameId);
        params.put("goodsCatalogueId",6);
        params.put("needWrite",true);
        params.put("inSell",true);
        action.put("action",params);
        String body = HttpRequest.post(url)
                .header("Token",token)
                .body(JSONObject.toJSONString(action)).execute().body();
        return JSONObject.parseObject(body).getString("data");
    }
    static String getOptionsValue(String token,String gameId){
        String url = "https://api.pzds.com/api/web-client/v2/userCenter/listGoodsPropertyConfigOptions";
        Map<String,Object> params = new HashMap<>();
        Map<String,Object> action = new HashMap<>();
        params.put("gameId",gameId);
        params.put("goodsCatalogueId",6);
        params.put("needWrite",true);
        params.put("inSell",true);
        action.put("action",params);
        String body = HttpRequest.post(url)
                .header("Token",token).header("Pzplatform", "pc")
                .body(JSONObject.toJSONString(action)).execute().body();
        return JSONObject.parseObject(body).getString("data");
    }

    public static String loginPanzhi(SalePartner salePartner){
        String url = "https://api.pzds.com/api/web-client/v2/user/public/login/password";
        Map<String, Object> params = new HashMap<>();
        Map<String, Object> action = new HashMap<>();
        params.put("phone", salePartner.getSaleKey());
        String string = DigestUtils.md5Hex(salePartner.getOther());
        params.put("password", string);
        params.put("openId", null);
        params.put("thirdType", null);
        params.put("unionId", null);
        action.put("action", params);

        // 生成 随机数 并生成sign  注意 &2147483647         &accessKey=3qXyB7uf
        StringBuilder sb = new StringBuilder();
        long PZTimestamp = System.currentTimeMillis();
        String Random = getRanString();
        sb.append("PZTimestamp=");
        sb.append(PZTimestamp);
        sb.append("&Random=");
        sb.append(Random);
        sb.append("&2147483647=");
        sb.append(JSONObject.toJSON(action));
        sb.append("&accessKey=3qXyB7uf");
        System.out.println(sb.toString());
        String b = sb.toString();
        try {
            b = URLEncoder.encode(b, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        b = b.replace("%26", "&");
        b = b.replace("%3D", "=");
        b = b.replaceAll("\\(", "%28");
        b = b.replaceAll("\\)", "%29");
        b = b.replaceAll("'", "%27");
        b = b.replaceAll("\\*", "%2A");
        b = b.replaceAll("~", "%7E");
        b = b.replaceAll("!|！", "%21");
        String sign = DigestUtils.md5Hex(b);
        //开始拼装请求
        String body = HttpRequest.post(url).header("Accept", "application/json, text/plain, */*")
                .header("PZTimestamp", String.valueOf(PZTimestamp))
                .header("Content-Type", "application/json;charset=UTF-8")
                .header("Origin", "https://www.pzds.com")
                .header("PZPlatform", "pc")
                .header("PZVersion", "1.0.0")
                .header("PZVersionCode", "1")
                .header("Random", Random)
                .header("Referer", "https://www.pzds.com/")
                .header("sign", sign)
                .header("sec-ch-ua-mobile", "?0")
                .header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like " +
                        "Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123 .0.0.0")
                .body(JSONObject.toJSONString(action)).execute().body();
        return JSONObject.parseObject(body).getString("data");
    }


}
